import {numFormat} from '@/utils/index'
export default {
	data () {	
		return {	
			// 柱状图
			bar: {		
				animation :false,					  
				grid: {
					left: '4%',
					right: '5%',
					bottom: '5%',
					containLabel: true
				},
				xAxis : [
				{
					axisLabel: {
						textStyle: {
							fontSize: 25,
						}
					},
					type : 'category',				
				},
				],
				yAxis : [
				{			
					axisLabel: {
						textStyle: {
							fontSize: 25,
						}
					},		
					type : 'value'
				}
				],
				series : [
				{
					name:'',
					type:'bar',
					barWidth: '80%',	
				}
				]
			},
			// 仪表盘
			gauge: {	
				series: [
				{			
					title : {
						fontSize: 23
					},		
					axisLabel: {            
						show: false,						
					},
					center : ['50%', '45%'],
					type: 'gauge',
					detail: {
						formatter: function (val) {                         
							return (val).toFixed(0) + '%'
						},	
						fontSize: 44,   
					},				
				}					
				]		
			},
			//饼图
			pie : {
				textStyle: {
					fontSize: DPR == 2 ? 27 : 15,   
				}, 
				legend: {
					orient: 'vertical',
					top:'20%',
					right: '10',	
					itemGap : 20,
					itemWidth : 50,				
					itemHeight : 20,
					selectedMode:false,				
				},
				series : [
				{
					name: '',
					type: 'pie',
					radius : '70%',
					center: ['35%', '50%'],
					itemStyle: {
						normal : {
							label : {
								position : 'top',
								formatter : function (params) {                         
									return (params.percent - 0).toFixed(0) + '%'
								}
							},                   
						},
					}
				}
				]
			},
			// 线性图
			line : {	
				tooltip : {
			        trigger: 'axis',
			        axisPointer: {
			            type: 'cross',
			            label: {
			                backgroundColor: '#6a7985'
			            }
			        },
			        textStyle: {
			            fontSize: DPR == 2 ? 27 : 15,   
			        },
			        formatter: function(params) {  
			        	let _isRatio = false
			        	if(params[0].seriesName.match(/^.*\s+$/)) {
			        		_isRatio = true
			        	}
			            
			            var relVal = params[0].name;    
			            for (var i = 0, l = params.length; i < l; i++) {    
			                relVal += '<br/>' + params[i].seriesName + ' : ' + numFormat(params[i].value, 2);    
			            }    
			            return relVal + (_isRatio ? '%' : '')    
			        }    
			    },	
			    legend: {        
			        x: 'center',
			        y: 'bottom',
			        textStyle: {
			            fontSize: DPR == 2 ? 27 : 17,   
			        },
			        selectedMode:false,
			    },		   		
				grid: {
					left: '5%',
					right: '5%',
					bottom: '15%',
					containLabel: true
				},
				xAxis : [
				{	
					axisLabel: {
						textStyle: {
							fontSize: DPR == 2 ? 27 : 23
						},		
						rotate : 45,			
					},
					boundaryGap : false,	
				}
				],
				yAxis : [
				{
					axisLabel: {
						textStyle: {
							fontSize: DPR == 2 ? 27 : 23
						},
						formatter: function (value, index) {
						    return numFormat(value, "0", true)
						}
					},
					type : 'value'
				}
				],
				series : [
				{					
					name:'',
					type:'line',
					stack: '',
				},
				]
			}
		}
	},
}



